import { Injectable } from '@angular/core';

@Injectable()
export class SidebarService {
  toggled = false;
  _hasBackgroundImage = true;
  menus = [
    {
      title: 'general',
      type: 'header',
    },
    {
      title: 'List',
      icon: 'fa fa-tachometer-alt',
      active: false,
      type: 'dropdown',
      badge: {
        text: 'New ',
        class: 'badge-warning',
      },

      submenus: [
        {
          title: 'Basic-List',
          link: '/pages/list/basic',
          active: true,
        },
        {
          title: 'Card-list',
          link: '/pages/list/card',
          active: false,
        },
        {
          title: 'Modal-bs',
          link: '/pages/list/modalbs',
          active: false,
        },
      ],
    },
    {
      title: 'Angular4.x学习',
      icon: 'fa fa-shopping-cart',
      active: false,
      type: 'dropdown',
      badge: {
        text: '3',
        class: 'badge-danger',
      },
      submenus: [
        {
          title: '文本插值',
          link: '/pages/learn/interpolation',
          active: false,
        },
        {
          title: '自定义组件',
          link: '/pages/learn/components',
          active: false,
        },
        {
          title: '表单',
          link: '/pages/learn/forms',
          active: false,
        },
        {
          title: 'http',
          link: '/pages/learn/http',
          active: false,
        },
      ],
    },

    {
      title: '动画',
      icon: 'fa fa-shopping-cart',
      active: false,
      type: 'dropdown',
      badge: {
        text: '3',
        class: 'badge-danger',
      },
      submenus: [
        {
          title: '简单用例',
          link: '/pages/animations/basic',
          active: false,
        },
        {
          title: '表单用例',
          link: '/pages/animations/formSlideUp',
          active: false,
        },
        {
          title: '指令用例',
          link: '/pages/animations/directive',
          active: false,
        },
      ],
    },

    {
      title: '组件',
      icon: 'fa fa-shopping-cart',
      active: false,
      type: 'dropdown',
      badge: {
        text: '3',
        class: 'badge-danger',
      },
      submenus: [
        {
          title: '金额指令',
          link: '/pages/cpts/currency',
          active: false,
        },
      ],
    },

    {
      title: 'Components',
      icon: 'far fa-gem',
      active: false,
      type: 'dropdown',
      submenus: [
        {
          title: 'General',
          active: false,
        },
        {
          title: 'Panels',
          active: false,
        },
        {
          title: 'Tables',
          active: false,
        },
        {
          title: 'Icons',
          active: false,
        },
        {
          title: 'Forms',
          active: false,
        },
      ],
    },
    {
      title: 'Charts',
      icon: 'fa fa-chart-line',
      active: false,
      type: 'dropdown',
      submenus: [
        {
          title: 'Pie chart',
          active: false,
        },
        {
          title: 'Line chart',
          active: false,
        },
        {
          title: 'Bar chart',
          active: false,
        },
        {
          title: 'Histogram',
          active: false,
        },
      ],
    },
    {
      title: 'Maps',
      icon: 'fa fa-globe',
      active: false,
      type: 'dropdown',
      submenus: [
        {
          title: 'Google maps',
          active: false,
        },
        {
          title: 'Open street map',
          active: false,
        },
      ],
    },
    {
      title: 'Extra',
      type: 'header',
    },
    {
      title: 'Documentation',
      icon: 'fa fa-book',
      active: false,
      type: 'simple',
      badge: {
        text: 'Beta',
        class: 'badge-primary',
      },
    },
    {
      title: 'Calendar',
      icon: 'fa fa-calendar',
      active: false,
      type: 'simple',
    },
    {
      title: 'Examples',
      icon: 'fa fa-folder',
      active: false,
      type: 'simple',
    },
  ];

  constructor() {}

  toggle() {
    this.toggled = !this.toggled;
  }

  getSidebarState() {
    return this.toggled;
  }

  setSidebarState(state: boolean) {
    this.toggled = state;
  }

  getMenuList() {
    return this.menus;
  }

  get hasBackgroundImage() {
    return this._hasBackgroundImage;
  }

  set hasBackgroundImage(hasBackgroundImage) {
    this._hasBackgroundImage = hasBackgroundImage;
  }
}
